package com.hl.controller;

import com.hl.validator.Mobile;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;


@Getter
@Setter
@Valid
public class Body {

    @NotNull(message = "name不能为空")
    @Length(min = 6, max = 10, message = "name长度不正确")
    String name;
    Integer age;

    @Valid
    @NotNull(message = "mobile不能为空")
    @Mobile(message = "mobile格式不正确")
    String mobile;

    @Override
    public String toString() {
        return "Body{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", mobile='" + mobile + '\'' +
                '}';
    }

}
